package software_construction.PatternProject.d4_observer.demo1.subject;

import software_construction.PatternProject.d4_observer.demo1.observer.Observer;

import java.util.List;

public class UpSubject implements Subject{
    private List<Observer> biliUsers=null;


    public UpSubject(List<Observer> biliUsers) {
        this.biliUsers = biliUsers;
    }

    @Override
    public void add(Observer observer) {
        biliUsers.add(observer);
    }

    @Override
    public void remove(Observer observer) {
        biliUsers.remove(observer);
    }

    @Override
    public void notify(String message) {
        for(Observer biliUser:biliUsers){
            biliUser.update(message);
        }
    }
}
